package com.mx.web.model;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.springframework.security.core.GrantedAuthority;

public class Authority implements GrantedAuthority {

	private static final long serialVersionUID = -4021076102036805325L;
	
	private String id;

	public Authority() {}
	
	public Authority(String id) {
		this.id = id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@Override
	public String getAuthority() {
		return id;
	}

	public boolean equals(Object obj) {
        if (!(obj instanceof Authority)) {
            return false;
        }
        if (this == obj) {
            return true;
        }
        Authority a = (Authority) obj;
        return new EqualsBuilder().append(id, a.id).isEquals();
    }

	public int hashCode() {
        return new HashCodeBuilder().append(id).toHashCode();
	}
}
